package com.mengyu.moeisland.net

import android.text.TextUtils
import com.mengyu.common.SpUtils
import okhttp3.Interceptor
import okhttp3.Response

class TokenInterceptor   @JvmOverloads constructor(): Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val token= SpUtils.getToken()
        if(!TextUtils.isEmpty(token)  ){
            return chain.proceed(chain.request().newBuilder().addHeader("token", token?:"").build())
        }
        return chain.proceed(chain.request())
    }
}